package com.newasia.server.common.template.dataItem.basics;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiChong
 * @description 设置指定值
 * @date 2020/4/21
 */
@Data
public class Cmd {

    private Integer on;
    private Integer off;
    private Integer on2;
    private Integer off2;
    private Integer on3;
    private Integer off3;
    private Integer on4;
    private Integer off4;

    public List<CmdMap> getCmdMaps(){
        List<CmdMap> cmdMaps = new ArrayList<CmdMap>();
        if(on!=null&&off!=null){
            cmdMaps.add(new CmdMap(on,off));
        }
        if(on2!=null&&off2!=null){
            cmdMaps.add(new CmdMap(on2,off2));
        }
        if(on3!=null&&off3!=null){
            cmdMaps.add(new CmdMap(on3,off3));
        }
        if(on4!=null&&off4!=null){
            cmdMaps.add(new CmdMap(on4,off4));
        }
        return cmdMaps;
    }

    @Data
    public class CmdMap{
        private Integer on;
        private Integer off;

        public CmdMap(Integer on,Integer off){
            this.on = on;
            this.off = off;
        }

        public CmdMap(){}
    }
}
